UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PqNgiDFFNQf2Duuk2syAFr2cYpMA5gfpHIyjhSgQ9hA='
WHERE
key_id = '9a5c59bfa3ffeb9c226c1ca6821d296968f26264316ed338cbc3286b28b09b58'
AND (
token = 'PqNgiDFFNQf2Duuk2syAFr2cYpMA5gfpHIyjhSgQ9hA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)