UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NtXNaXskxOPipOA4+AvbBGzyPdxovQnepDYQmuYYkaQ='
WHERE
key_id = 'f50c2caea25ce330ba0db39638e248ab73fe697ed811ed312e6f18fb4b71618f'
AND (
token = 'NtXNaXskxOPipOA4+AvbBGzyPdxovQnepDYQmuYYkaQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)