UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'niK3c6M12tFDebwBCo9kLnfybuX+PXrV4NTY6RfcNoE='
WHERE
key_id = 'd6d39e87e62bab9d458456011e112fede5f0c040908fb4e2eefaac437c3e49fa'
AND (
token = 'niK3c6M12tFDebwBCo9kLnfybuX+PXrV4NTY6RfcNoE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)