UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'potrGTB70BAi7Ey1lhHsHtI4PV5/RSpuZ7ItBMiGMWU=' 
WHERE 
  key_id = 'fdb915fda7c4cf6d8eef41c32217801b7964fc55316569a7b5f1cc5d02fb68c2' 
  AND (
    token = 'potrGTB70BAi7Ey1lhHsHtI4PV5/RSpuZ7ItBMiGMWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040