UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8dUs4Xpthc3SffZd/2kj+osIJf1fmwpjLFgoHdOBckE='
WHERE
key_id = '7c74b9d62bc6959f7942835e26eed85785c0d95774472e8d37217642faef7a9b'
AND (
token = '8dUs4Xpthc3SffZd/2kj+osIJf1fmwpjLFgoHdOBckE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)