UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o8oDhxhysyTiAd+WKV1zBSkdhVk2u46sfI18rqkRjLk=' 
WHERE 
  key_id = 'a23cc70451e92aa30df0bab21091d6e5975d409d60fadaf17b2770d29172ddde' 
  AND (
    token = 'o8oDhxhysyTiAd+WKV1zBSkdhVk2u46sfI18rqkRjLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032