UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ca4bDnxCffAoNLmxT/kNO8iU3gYHUExyM1lkaZq6aS8='
WHERE
key_id = 'fc1f9c170b9d09d4789568f73020a7f13612eec613e1b57913fa6edc8a2ec4bd'
AND (
token = 'Ca4bDnxCffAoNLmxT/kNO8iU3gYHUExyM1lkaZq6aS8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)