UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't7R//1mKO+YHH2rJEQWHqvI+ki/Gin6aRWejBdQ0WLs=' 
WHERE 
  key_id = '0242fbc4135c233e2005d2f84b230e45145922288a2d1c0148ff82dc3cfa5d44' 
  AND (
    token = 't7R//1mKO+YHH2rJEQWHqvI+ki/Gin6aRWejBdQ0WLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025