UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J+TsKgJedfdxYNGwYO9l+JcP/9RBb5R3zhByg1Gj1LE=' 
WHERE 
  key_id = '97159b9d08bd16e5c25d749c9384a329b1da857e3b448b2f525454415c11a53c' 
  AND (
    token = 'J+TsKgJedfdxYNGwYO9l+JcP/9RBb5R3zhByg1Gj1LE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038