UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm+2F7U9XmEBMl4ZunBA1iRSQqMEkxzKvIG9WTyms6eo='
WHERE
key_id = 'a14c4c116e30c87610454c51a4fb4d08faf1f4623f75e0aba64631e3a863fc50'
AND (
token = 'm+2F7U9XmEBMl4ZunBA1iRSQqMEkxzKvIG9WTyms6eo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)