UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+r46zMHNy9woMDBNEWl5L0knYcsr2IdW1Z5NtAp3sGw=' 
WHERE 
  key_id = '8e657cc44138f1f0f9a3405f83e8c19febb895bd091770d9b5431f2ad59034e7' 
  AND (
    token = '+r46zMHNy9woMDBNEWl5L0knYcsr2IdW1Z5NtAp3sGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019