UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ikyB4xYMl9HCuevtV4AgkOHsn4dFkFRB4wn1+cOgo/c=' 
WHERE 
  key_id = '662ca2ddae35557f82b48b70e451dc29be77f5a022d25501fcf582c386806dea' 
  AND (
    token = 'ikyB4xYMl9HCuevtV4AgkOHsn4dFkFRB4wn1+cOgo/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039