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