UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cm0oyeWuZaX+QCJLS6MT409Ri66IWpsp651mC+Jsr9g=' 
WHERE 
  key_id = '3f7e8d4f3133645c99971853e5e905911a44c2f541479496080a637772a5159c' 
  AND (
    token = 'Cm0oyeWuZaX+QCJLS6MT409Ri66IWpsp651mC+Jsr9g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026