UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e52Cuq3YCCxHEzldTRdxICakbBUPIRXMMjxoQL3EqsM='
WHERE
key_id = '3f4a3cb0dbd6f9f92fdf8d6ef57c65ebfab85279a43d84b8eaa4487dd7766626'
AND (
token = 'e52Cuq3YCCxHEzldTRdxICakbBUPIRXMMjxoQL3EqsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)