UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z836nKik4UFKnlt8qZxMxfkRAfyzF/jGDWCFoAOAHD0='
WHERE
key_id = 'f4d76f408d013daec5ee9827663901c05a0b3cb31c3fa78e8c6dd66b7db299a6'
AND (
token = 'z836nKik4UFKnlt8qZxMxfkRAfyzF/jGDWCFoAOAHD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)