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

Query time 0.00017