UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zSPK66AfTFZwnvH64hTN5mYUaj1lWHK4BC3kUEzjnsI='
WHERE
key_id = 'c696d525d59795b7ae2ffa5c6b4e8233ff557a7dc4be0297851b45e80d072c3a'
AND (
token = 'zSPK66AfTFZwnvH64hTN5mYUaj1lWHK4BC3kUEzjnsI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)