UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ze5hgHs3uDOxMidJoFMATCepD590whEu1pbpBLd/bGk=' 
WHERE 
  key_id = '4172b1e05ea231b98ab489fcce8ab8c39595f407494ce210af538b4a717db1eb' 
  AND (
    token = 'Ze5hgHs3uDOxMidJoFMATCepD590whEu1pbpBLd/bGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024