UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'olOziWqCpZKthLJ7OsLNXLE58SeAsK05xDctninOdxc=' 
WHERE 
  key_id = '9e4f82c1c20809c9ca58ef2a55e58edbaaa5a75cbedb1b3829d6258a2244ba1f' 
  AND (
    token = 'olOziWqCpZKthLJ7OsLNXLE58SeAsK05xDctninOdxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046