UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6/Rtpcj+KVjCpoKagGkoupsS3sIO0vG51cj65Qilg98=' 
WHERE 
  key_id = 'd788a3e4bceb744e681c8d81993c09535be92cf9c20642f8ccf9a950586a211c' 
  AND (
    token = '6/Rtpcj+KVjCpoKagGkoupsS3sIO0vG51cj65Qilg98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023