UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WCQwfz0+nLjAPSb9NMldZE4+KqD63cUI8GIPYOmeKJs='
WHERE
key_id = 'e534d8888f8787cb8f6ecff1dd1b58d4d7af2df400840cff719e0c1096c2b9f5'
AND (
token = 'WCQwfz0+nLjAPSb9NMldZE4+KqD63cUI8GIPYOmeKJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)