UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R3dYS3SJCLG8XVB92J9Rpoi6xLpd6I+j3Kn8S61KIns='
WHERE
key_id = 'f63e988b2da13e45e338bdffab326074eee681e6a22f39859d6485e06c87bcf6'
AND (
token = 'R3dYS3SJCLG8XVB92J9Rpoi6xLpd6I+j3Kn8S61KIns='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)