UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8SpXu29lXt6S5AWol1XZuQyTOpB1AKrTPb+cWg20Mdk=' 
WHERE 
  key_id = '3c63e59450eb2426e914897605c730a9eb920d725e846bc19324f22843485f2b' 
  AND (
    token = '8SpXu29lXt6S5AWol1XZuQyTOpB1AKrTPb+cWg20Mdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035