UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q1HHqK27UQTJUcV813lgBkFtBMnQd0ClArOBLUKFyTg=' 
WHERE 
  key_id = '123cb86840c2beb53f9b8ad02a5f50256b3fbbec5e16731f003c26b0f51b7f7c' 
  AND (
    token = 'Q1HHqK27UQTJUcV813lgBkFtBMnQd0ClArOBLUKFyTg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037