UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NEk0rVAwqlGnUL7JGGOpEc7P2Bn/N1s8+39Rh+YzzDw='
WHERE
key_id = 'a40c000c92f378f03fed9acd4f12670640545a75598d15491d90791155475957'
AND (
token = 'NEk0rVAwqlGnUL7JGGOpEc7P2Bn/N1s8+39Rh+YzzDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)