UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AbHoIXn05rXojMbdLhU1cowOakhKpKVhralJOtjCEWc=' 
WHERE 
  key_id = 'e3f029775dd4c96b12869c02c50ba1072d0816252df9a5c99ace4c9fd160a28a' 
  AND (
    token = 'AbHoIXn05rXojMbdLhU1cowOakhKpKVhralJOtjCEWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021