UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yNJa0nJAQdb3dXqDGzzmDCgyBIEES3mUt2AIKL5B28E='
WHERE
key_id = '7d3308878c7e6b4c612a96fd234cf8e82319940d9d606b157ea2598522a57cb0'
AND (
token = 'yNJa0nJAQdb3dXqDGzzmDCgyBIEES3mUt2AIKL5B28E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)