UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gEUugIqnEe7eEogpoQDOIYPn839YDRtsV0AO44qNuIQ='
WHERE
key_id = '8507277f0d6e7a7a983d3d180d20f190dcfdfb12340f5d2105d0586e10cc30d8'
AND (
token = 'gEUugIqnEe7eEogpoQDOIYPn839YDRtsV0AO44qNuIQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)