UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hOUFQ+gme8oqqKRAyNBkE5A81Qr1b1Q67eLh5dw7784=' 
WHERE 
  key_id = '363f15138e9d2ee3a85013f02338ae54ee37997ea86515563e1fc23607d3ac21' 
  AND (
    token = 'hOUFQ+gme8oqqKRAyNBkE5A81Qr1b1Q67eLh5dw7784=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036