UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gAmBWgqH8IVPhc2epMbjXou7U21LXzl1Qfdxxjqs70A='
WHERE
key_id = '02c274e66a4327183c815c69317f7d7b1a707725cdbcbf4a9aa3b2cb9c54bd45'
AND (
token = 'gAmBWgqH8IVPhc2epMbjXou7U21LXzl1Qfdxxjqs70A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)