UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZVCw6IKLtl9LSjB5WlspskCdSBKXNVmt+gfHbJoERU=' 
WHERE 
  key_id = '49e361ba922f9419a4e3563ce4488fcba5b3122173e20f60b4e4d471e78998a7' 
  AND (
    token = 'XZVCw6IKLtl9LSjB5WlspskCdSBKXNVmt+gfHbJoERU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033