UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't9rpEUbe2+JIE/ooORvDDTidt5gzACh121F7GgZnGrk='
WHERE
key_id = '9b99cc017db2eb743ffdb0b27221d2c36550d22e53800e44e9f5896abc117766'
AND (
token = 't9rpEUbe2+JIE/ooORvDDTidt5gzACh121F7GgZnGrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)