UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ILbXAMx2rDU+5AKnSzu4l4dEuiock+QDKw/ALXdwPQ=' 
WHERE 
  key_id = '9308a08f376566ce803bcd1985a7f2489224927e552d7dda465c37c25d306a6d' 
  AND (
    token = '7ILbXAMx2rDU+5AKnSzu4l4dEuiock+QDKw/ALXdwPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024