UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h4AjgNP//1Kq7FSt1T7qgp2RcbsvUVMoHnRzU1maIVQ=' 
WHERE 
  key_id = '272c7965d831e9ad6b75bc94805f30d90ef7bb837d802cabb785e9b131e90496' 
  AND (
    token = 'h4AjgNP//1Kq7FSt1T7qgp2RcbsvUVMoHnRzU1maIVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047